package com.dj.msgtable.dao;

import com.dj.msgtable.entity.Custom;
import com.dj.msgtable.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {



    //登录验证
    @Select("Select * From user where userName = #{userName} and password = #{password}" )
    public User searchUser(User user);
    //高级账号用户查询
    @Select("Select * From user where rank = 1" )
    public List<User> searchUserByHigh(User user);
    //中级账号用户查询
    @Select("Select * From user where rank = 2" )
    public List<User> searchUserByMiddle(User user);

    //用户名查询
    @Select("Select * From user where userName = #{userName}" )
    public User searchUserByName(User user);

    //高级账号添加用户
    @Insert("insert into user (userName,password,realName,rank) value (#{userName},#{password},#{realName},1)")
    public boolean addUserByHigh(User user);

    //中级账号添加用户
    @Insert("insert into user (userName,password,realName,rank) value (#{userName},#{password},#{realName},2)")
    public boolean addUserByMiddle(User user);


    @Select("Select * From user where id=#{id}" )
    public User searchUserById(User user);

    @Update("UPDATE user SET dailyNum = #{dailyNum} WHERE id = #{id}")
    public void addUserDailyNum(User user);


    @Update("UPDATE user SET dailyNum = 0")
    public void dailyWork();


}
